// GameDB.cpp : implementation file
//

#include "stdafx.h"
#include "GameDB.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CGameDB

// for static member
CString CGameDB::m_DSN;
CString CGameDB::m_Table;
CString CGameDB::m_UID;
CString CGameDB::m_Pass;


IMPLEMENT_DYNAMIC(CGameDB, CRecordset)

CGameDB::CGameDB(CDatabase* pdb)
	: CRecordset(pdb)
{
	//{{AFX_FIELD_INIT(CGameDB)
	m_ID = _T("");
	m_Name = _T("");
	m_ConnectTime = 0;
	m_Level = 0;
	m_RankLevel = 0;
	m_WinPro = 0;
	m_WinNum = 0;
	m_LooseNum = 0;
	//m_DrawNum = 0;
	m_Point = 0;
	m_LevelPoint = 0;
	m_Marble = 0;
	m_Item0 = 0;
	m_Item1 = 0;
	m_Item2 = 0;
	m_Item3 = 0;
	m_MPoint = 0;
	m_nFields = 16;
	//}}AFX_FIELD_INIT
	m_nDefaultType = snapshot;
}


CString CGameDB::GetDefaultConnect()
{
	//return _T("ODBC;DSN=NetmarbleUserDB;UID=Sqladmin;PWD=net885;");
	CString rtn;
	rtn.Format("ODBC;DSN=%s;UID=%s;PWD=%s;", (LPCTSTR)m_DSN, (LPCTSTR)m_UID, (LPCTSTR)m_Pass);
	return rtn;
}

CString CGameDB::GetDefaultSQL()
{
	//return _T("[TetrisUserDB]");
	CString rtn;
	rtn.Format("%s", (LPCTSTR)m_Table);
	return rtn;
}

void CGameDB::DoFieldExchange(CFieldExchange* pFX)
{
	//{{AFX_FIELD_MAP(CGameDB)
	pFX->SetFieldType(CFieldExchange::outputColumn);
	RFX_Text(pFX, _T("[ID]"), m_ID);
	RFX_Text(pFX, _T("[Name]"), m_Name);
	RFX_Long(pFX, _T("[ConnectTime]"), m_ConnectTime);
	RFX_Long(pFX, _T("[Level]"), m_Level);
	RFX_Long(pFX, _T("[RankLevel]"), m_RankLevel);
	RFX_Double(pFX, _T("[WinPro]"), m_WinPro);
	RFX_Long(pFX, _T("[WinNum]"), m_WinNum);
	RFX_Long(pFX, _T("[LooseNum]"), m_LooseNum);
	//RFX_Long(pFX, _T("[DrawNum]"), m_DrawNum);
	RFX_Long(pFX, _T("[Point]"), m_Point);
	RFX_Long(pFX, _T("[LevelPoint]"), m_LevelPoint);
	RFX_Long(pFX, _T("[GMoney]"), m_Marble);
	RFX_Byte(pFX, _T("[Item0]"), m_Item0);
	RFX_Byte(pFX, _T("[Item1]"), m_Item1);
	RFX_Byte(pFX, _T("[Item2]"), m_Item2);
	RFX_Byte(pFX, _T("[Item3]"), m_Item3);
	RFX_Long(pFX, _T("[MPoint]"), m_MPoint);
	//}}AFX_FIELD_MAP
}

/////////////////////////////////////////////////////////////////////////////
// CGameDB diagnostics

#ifdef _DEBUG
void CGameDB::AssertValid() const
{
	CRecordset::AssertValid();
}

void CGameDB::Dump(CDumpContext& dc) const
{
	CRecordset::Dump(dc);
}
#endif //_DEBUG
